//
//  PlaneOrderController.m
//  旅游趣吧
//
//  Created by 高亦 on 15/10/30.
//  Copyright © 2015年 lampshade. All rights reserved.
//  飞机票订单详情

#import "PlaneOrderController.h"
#import "PlaneOrderHeaderView.h"

@interface PlaneOrderController()
@property (weak, nonatomic) IBOutlet UILabel *ticketPrice;
@property (weak, nonatomic) IBOutlet UILabel *buildPrice;
@property (weak, nonatomic) IBOutlet UILabel *oilPrice;
- (IBAction)psgType:(id)sender;
@property (weak, nonatomic) IBOutlet UILabel *tips;
@property (weak, nonatomic) IBOutlet UITextField *contactName;
@property (weak, nonatomic) IBOutlet UITextField *phoneNum;
- (IBAction)addPsg:(id)sender;
@property (weak, nonatomic) IBOutlet UILabel *sumPrice;
@property (weak, nonatomic) IBOutlet UIButton *submitBtn;



@end

@implementation PlaneOrderController
@synthesize ticketPrice,buildPrice,oilPrice,contactName,phoneNum,tips;
- (void)viewDidLoad{
    [super viewDidLoad];
    [self initPlaneOrderView];
    [self setHeaderViewForTableView];
}

- (void)initPlaneOrderView{
    
    //设置视图Navigation标题
    NSString *offCityName = [self.flightDetail objectForKey:@"offCityName"];
    NSString *arrCityName = [self.flightDetail objectForKey:@"arrCityName"];
    NSString *NA_Title = [offCityName stringByAppendingString:@"→"];
    NA_Title = [NA_Title stringByAppendingString:arrCityName];
    self.navigationItem.title = NA_Title;
    
    self.ticketPrice.text = self.codeModel.Price;
    self.buildPrice.text = self.listModel.AirportFee;
    self.oilPrice.text = self.listModel.Oil;
    self.sumPrice.text = self.codeModel.Price;
    
    contactName.delegate = self;
    phoneNum.delegate = self;
    
    //设置label的内容，颜色以及自动换行
    tips.text = @"*请仔细核对乘机人姓名，证件号码，以免在办理登机手续时遇到问题";
    tips.textColor = [UIColor colorWithRed:200.0f/255 green:200.0f/255 blue:200.0f/255 alpha:1];
    tips.numberOfLines = 0;
    
    self.submitBtn.layer.cornerRadius = 6;
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    [self.view endEditing:YES];
    return YES;
}
- (void)setHeaderViewForTableView{
    
    UIView *headerView = [[PlaneOrderHeaderView alloc]setPlaneOrderHeaderView:self.tableView setListModel:self.listModel setCodeModel:self.codeModel];
    
    self.tableView.tableHeaderView = headerView;
}

- (IBAction)addPsg:(id)sender {
    NSLog(@"%@",sender);
}
- (IBAction)psgType:(id)sender {
    NSLog(@"%@",sender);
}
@end
